<%--
  Created by IntelliJ IDEA.
  User: 34321
  Date: 2021/9/27
  Time: 9:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form method="post" action="${pageContext.request.contextPath}/login">
    <label>用户名</label><input type="text" name="username"><br>
    <label>密码</label><input type="password" name="password"><br>
    <label>验证码</label><input type="text" name="code"><br>
    <button type="submit">登录</button>
    <a href="page/register.jsp">注册</a>
    <a href="delects.jsp">删除</a>
    <span>
        <%
            int random = (int) (Math.random() * 8999 + 1000);
            String code = random + "";
            session.setAttribute("scode", code);
            session.setMaxInactiveInterval(60);
            response.getWriter().write(code);
        %>
    </span>
    <span>
        <%
            String mage = (String) request.getAttribute("mage");
            if (mage != null && "" != mage) {
                response.getWriter().write(mage);
            }
        %>
    </span>
</form>

</body>
</html>
